import { reactive,readonly } from "vue";

import {getBlogType}from "../api/getHomeInfo"

const Blogtype = reactive([]);
let sum = 0;
export async function getType(){

   if(Blogtype.length > 0) return;
    const result = await getBlogType();
    result.data.map((itme)=>{
        sum += itme.sum;
    })
     Blogtype.push(...result.data);
     Blogtype.unshift({
         name:"全部",
         sum
     })

     
     return Blogtype;
}

export const type = readonly(Blogtype);

